package com.youhome.service.service.impl;


import com.youhome.service.service.JFreeChartService;
import com.youhome.service.utils.ChartUtil;

import com.youhome.service.utils.CustomRender;
import com.youhome.service.utils.TimeString;
import com.youhome.utils.DateUtils;

import org.jfree.chart.ChartFactory;
import org.jfree.chart.JFreeChart;
import org.jfree.chart.StandardChartTheme;
import org.jfree.chart.axis.*;
import org.jfree.chart.labels.StandardCategoryItemLabelGenerator;
import org.jfree.chart.labels.StandardXYItemLabelGenerator;
import org.jfree.chart.plot.CategoryPlot;
import org.jfree.chart.plot.Plot;
import org.jfree.chart.plot.PlotOrientation;
import org.jfree.chart.plot.XYPlot;
import org.jfree.chart.renderer.category.BarRenderer;
import org.jfree.chart.renderer.category.LineAndShapeRenderer;
import org.jfree.chart.renderer.category.StandardBarPainter;
import org.jfree.chart.renderer.xy.XYLineAndShapeRenderer;
import org.jfree.chart.ui.RectangleEdge;
import org.jfree.chart.ui.TextAnchor;
import org.jfree.data.category.DefaultCategoryDataset;
import org.jfree.data.general.DefaultPieDataset;
import org.jfree.data.time.TimeSeriesCollection;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;

import java.awt.*;
import java.awt.geom.Rectangle2D;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.List;

/**
 * Created by chen365 on 2018/08/31.
 */
@Service
public class JFreeChartServiceImpl implements JFreeChartService {
    private String PAHT = "/alldata/chart/";
    private Color Tick_Label_COLOR = new Color(51, 51, 51);
    private Color GRID_LINE_COLOR = new Color(226, 226, 226); //网格横线颜色
    private Color COLOR_WHITE = Color.white; //颜色(白)
    //private Font Tick_Label_Font = new Font("宋体", Font.PLAIN, 14);
    private Font Label_Font = new Font("sans-serif", Font.PLAIN, 14);
    private Font Tick_Label_Font = new Font("sans-serif", Font.PLAIN, 14);
    private Font TITLE_FONT = new Font("sans-serif", Font.PLAIN, 20);
    private Font FONT_16 = new Font("sans-serif", Font.PLAIN, 16);
    private Font FONT_20 = new Font("sans-serif", Font.PLAIN, 20);
    private Font FONT_25 = new Font("sans-serif", Font.PLAIN, 25);

    @Override
    public String barChart(String title, DefaultCategoryDataset dataSet) {
        StandardChartTheme standardChartTheme = new StandardChartTheme("unicode"); //创建主题样式
        standardChartTheme.setExtraLargeFont(new Font("宋体", Font.BOLD, 20)); //设置标题字体
        standardChartTheme.setRegularFont(new Font("宋体", Font.PLAIN, 15)); //设置图例的字体
        standardChartTheme.setLargeFont(new Font("宋体", Font.PLAIN, 15)); //设置轴向的字体
        ChartFactory.setChartTheme(standardChartTheme);//设置主题样式

        // 通过ChartFactory创建JFreeChart
        JFreeChart chart = ChartFactory.createBarChart(
                title, //图表标题
                "", //横轴标题
                "",//纵轴标题
                dataSet,//数据集合
                PlotOrientation.VERTICAL, //图表方向
                false,//是否显示图例标识
                false,//是否显示tooltips
                false);//是否支持超链接

        chart.setTextAntiAlias(false);
        chart.getRenderingHints().put(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_OFF);
        chart.getTitle().setFont(new Font("宋体", Font.PLAIN, 20)); // 设置标题字体
        chart.setBorderVisible(true); // 设置显示边框
        CategoryPlot plot = chart.getCategoryPlot(); // 获取绘图区对象
        plot.setForegroundAlpha(1F);//设置绘图区前景色透明度
        plot.setBackgroundAlpha(0.3F);//设置绘图区背景色透明度

        CategoryAxis categoryAxis = plot.getDomainAxis();//获取坐标轴对象

        categoryAxis.setLabelFont(new Font("宋体", Font.PLAIN, 12));//设置坐标轴标题字体
        categoryAxis.setTickLabelFont(new Font("宋体", Font.PLAIN, 12));//设置坐标轴尺值字体
        categoryAxis.setCategoryLabelPositions(CategoryLabelPositions.UP_45);// 设置坐标轴标题旋转角度

        ValueAxis valueAxis = plot.getRangeAxis();// 设置数据轴对象
        valueAxis.setLabelFont(new Font("宋体", Font.PLAIN, 12));

        BarRenderer renderer = new CustomRender();
        // 设置柱状图的顶端显示数字
        //renderer.setIncludeBaseInRange(true);
        renderer.setDefaultItemLabelGenerator(new StandardCategoryItemLabelGenerator());
        renderer.setDefaultItemLabelsVisible(true);
        //设置柱子顶部提示字体与大小
        renderer.setDefaultItemLabelFont(new Font("宋体", Font.PLAIN, 16));
        // 设置柱子为平面图不是立体的
        renderer.setBarPainter(new StandardBarPainter());

        // 设置柱状图之间的距离0.1代表10%；
        renderer.setItemMargin(0.01);
        // 设置柱子的阴影，false代表没有阴影
        renderer.setShadowVisible(false);

        renderer.setMaximumBarWidth(0.1); // 宽度
        renderer.setMinimumBarLength(0.0); //长度

        plot.setRenderer(renderer);

        String filename = new TimeString().getTimeString() + ".jpg";
        ChartUtil.saveAsFile(chart, "jpg", "/alldata/chart/" + filename, 500, 500);

        return filename;
    }

    @Override
    public String pieChart(String title, DefaultPieDataset dataSet) {
        StandardChartTheme standardChartTheme = new StandardChartTheme("unicode"); //创建主题样式
        standardChartTheme.setExtraLargeFont(new Font("宋体", Font.BOLD, 20)); //设置标题字体
        standardChartTheme.setRegularFont(new Font("宋体", Font.PLAIN, 15)); //设置图例的字体
        standardChartTheme.setLargeFont(new Font("宋体", Font.PLAIN, 15)); //设置轴向的字体
        ChartFactory.setChartTheme(standardChartTheme);//设置主题样式

        JFreeChart chart = ChartFactory.createPieChart3D(title, // 图表标题
                dataSet, // 数据集
                true, // 是否显示图例
                false, // 是否生成工具
                false // 是否生成URL链接
        );
        chart.setTextAntiAlias(false);
        chart.getRenderingHints().put(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_OFF);
        chart.getTitle().setFont(new Font("宋体", Font.PLAIN, 20)); // 设置标题字体
        chart.setBorderVisible(false); // 设置显示边框
        Plot plot = chart.getPlot(); // 获取绘图区对象
        plot.setForegroundAlpha(0.9F);//设置绘图区前景色透明度
        plot.setBackgroundAlpha(0.1F);//设置绘图区背景色透明度

        // 创建图表
        String filename = new TimeString().getTimeString() + ".jpg";
        ChartUtil.saveAsFile(chart, "jpg", "/alldata/chart/" + filename, 500, 500);
        return filename;
    }

    @Override
    public String lineChart(String title, String categoryAxisLabel, String valueAxisLabel, String unit, DefaultCategoryDataset dataSet) {
        if (!StringUtils.isEmpty(unit)) {
            valueAxisLabel += "(" + unit + ")";
        }
        ChartFactory.setChartTheme(getStandardChartTheme());//设置主题样式
        // 创建JFreeChart对象：ChartFactory.createLineChart
        JFreeChart chart = ChartFactory.createLineChart(title, // 标题
                categoryAxisLabel, // categoryAxisLabel （category轴，横轴，X轴标签）
                valueAxisLabel, // valueAxisLabel（value轴，纵轴，Y轴的标签）
                dataSet, // 数据
                PlotOrientation.VERTICAL,
                true, // legend
                false, // tooltips
                false); // URLs
        chart.setBorderVisible(false);  //是否显示边框
        chart.getTitle().setFont(TITLE_FONT); // 设置标题字体

        // 使用CategoryPlot设置各种参数。以下设置可以省略。
        CategoryPlot plot = (CategoryPlot) chart.getPlot();
        plot.setOutlineVisible(false); //设置数据区的边界线条是否可见

        plot.setBackgroundPaint(Color.white); // 网格背景色
        plot.setDomainGridlinePaint(Color.black); // 网格竖线颜色
        plot.setDomainGridlinesVisible(false); //网格竖线是否可见

        plot.setRangeGridlinePaint(GRID_LINE_COLOR); // 网格横线颜色
        plot.setRangeGridlinesVisible(true); //网格横线是否可见
        // 背景色 透明度
        plot.setBackgroundAlpha(0.1f);
        // 前景色 透明度
        plot.setForegroundAlpha(0.9f);
        // 其他设置 参考 CategoryPlot类


//        NumberAxis numAxis = (NumberAxis) plot.getRangeAxis();
//        numAxis.setTickUnit(new NumberTickUnit(1));//设置Y轴间隔

        CategoryAxis categoryAxis = plot.getDomainAxis();//获取坐标轴对象
        categoryAxis.setLabelFont(Label_Font);//设置坐标轴标题字体
        categoryAxis.setTickLabelFont(Tick_Label_Font);//设置坐标轴尺值字体
        categoryAxis.setTickLabelPaint(Tick_Label_COLOR);
        categoryAxis.setCategoryLabelPositions(CategoryLabelPositions.UP_45);// 设置坐标轴标题旋转角度
        categoryAxis.setTickMarkInsideLength(3);

        LineAndShapeRenderer renderer = (LineAndShapeRenderer) plot.getRenderer();
        renderer.setDefaultShapesVisible(false); // series 点（即数据点）可见
        renderer.setDefaultLinesVisible(true); // series 点（即数据点）间有连线可见
        //renderer.setUseSeriesOffset(true); // 设置偏移量
        renderer.setDefaultItemLabelGenerator(new StandardCategoryItemLabelGenerator());
        renderer.setDefaultItemLabelsVisible(false);  //是否显示折点的值

        renderer.setSeriesStroke(0, new BasicStroke(0.5F));//设置折线大小
        renderer.setSeriesStroke(1, new BasicStroke(0.5F));//设置折线大小
        renderer.setSeriesStroke(2, new BasicStroke(0.5F));//设置折线大小
        renderer.setSeriesStroke(3, new BasicStroke(0.5F));//设置折线大小
        renderer.setSeriesStroke(4, new BasicStroke(0.5F));//设置折线大小

        renderer.setSeriesPaint(0, new Color(193, 35, 43));//设置折线颜色
        renderer.setSeriesPaint(1, new Color(0, 184, 238));//设置折线颜色
        renderer.setSeriesPaint(2, new Color(210, 51, 91));//设置折线颜色
        renderer.setSeriesPaint(3, new Color(254, 158, 37));//设置折线颜色
        renderer.setSeriesPaint(4, new Color(143, 195, 32));//设置折线颜色

        String filename = new TimeString().getTimeString() + ".jpg";
        ChartUtil.saveAsFile(chart, "jpg", "/alldata/chart/" + filename, 800, 500);

        return filename;
    }

    @Override
    public String timeSeriesChart(String title, String timeAxisLabel, String valueAxisLabel, String unit,
                                  TimeSeriesCollection dataSet, Date lower, Date upper) {
        if (!StringUtils.isEmpty(unit)) {
            valueAxisLabel += "(" + unit + ")";
        }
        ChartFactory.setChartTheme(getStandardChartTheme());
        JFreeChart chart = ChartFactory.createTimeSeriesChart(
                title,
                timeAxisLabel,
                valueAxisLabel,
                dataSet,
                false,
                false,
                false);
        // 设置日期显示格式
        XYPlot plot = chart.getXYPlot();

        NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
        rangeAxis.setAutoRangeIncludesZero(true);
        rangeAxis.setTickLabelFont(Tick_Label_Font);
        rangeAxis.setTickLabelPaint(Tick_Label_COLOR);

//        DateAxis axis = (DateAxis) plot.getDomainAxis();
//        axis.setDateFormatOverride(new SimpleDateFormat("yyyy/MM"));
//        //axis.setTickUnit(new DateTickUnit(DateTickUnitType.MONTH, 3));//设置时间间隔为一天
//        axis.setTickLabelPaint(Color.lightGray);
//        axis.setTickLabelFont(new Font("sans-serif", Font.PLAIN, 14));
//        axis.setVerticalTickLabels(true);
//        //axis.setPositiveArrowVisible(true);
//        //axis.setTickMarkPosition(DateTickMarkPosition.START);
        setLineAndShapeRenderer(plot);
//        XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) plot.getRenderer();
//        renderer.setDefaultShapesVisible(false); // series 点（即数据点）可见
//        renderer.setDefaultLinesVisible(true); // series 点（即数据点）间有连线可见
//        //renderer.setUseSeriesOffset(true); // 设置偏移量
//        renderer.setDefaultItemLabelGenerator(new StandardXYItemLabelGenerator());
//        renderer.setDefaultItemLabelsVisible(false);  //是否显示折点的值
//
//        renderer.setSeriesStroke(0, new BasicStroke(1.2F));//设置折线大小
//        renderer.setSeriesStroke(1, new BasicStroke(0.8F));//设置折线大小
//        renderer.setSeriesStroke(2, new BasicStroke(0.8F));//设置折线大小
//        renderer.setSeriesStroke(3, new BasicStroke(0.8F));//设置折线大小
//        renderer.setSeriesStroke(4, new BasicStroke(0.8F));//设置折线大小
//
//        renderer.setSeriesPaint(0, new Color(193, 35, 43));//设置折线颜色
//        renderer.setSeriesPaint(1, new Color(0, 184, 238));//设置折线颜色
//        renderer.setSeriesPaint(2, new Color(210, 51, 91));//设置折线颜色
//        renderer.setSeriesPaint(3, new Color(254, 158, 37));//设置折线颜色
//        renderer.setSeriesPaint(4, new Color(143, 195, 32));//设置折线颜色


        DateAxis dateAxis = new DateAxis("日期") {
            /**
             * 重写 x 轴（日期斜角显示）
             * @param g2
             * @param dataArea
             * @param edge
             * @return
             */
            @Override
            protected List refreshTicksHorizontal(Graphics2D g2, Rectangle2D dataArea, RectangleEdge edge) {
                List ticks = super.refreshTicksHorizontal(g2, dataArea, edge);
                List<DateTick> newTicks = new ArrayList<>();
                for (Iterator it = ticks.iterator(); it.hasNext(); ) {
                    DateTick tick = (DateTick) it.next();
                    System.err.println(DateUtils.DateToStr(tick.getDate(), "yyyy-MM-dd"));
                    DateTick dateTick = new DateTick(
                            tick.getDate(),
                            tick.getText(),
                            TextAnchor.TOP_RIGHT,
                            TextAnchor.TOP_RIGHT,
                            -Math.PI / 3
                    );
                    newTicks.add(dateTick);
                }
                return newTicks;
            }
        };
        if (!StringUtils.isEmpty(lower) && !StringUtils.isEmpty(upper)) {
            dateAxis.setRange(lower, upper);
        }
        dateAxis.setTickUnit(new DateTickUnit(DateTickUnitType.MONTH, 1));//设置时间间隔
        dateAxis.setDateFormatOverride(new SimpleDateFormat("yyyy/MM")); //日期格式化
        dateAxis.setTickLabelFont(Tick_Label_Font); //x轴标签字体与大小
        dateAxis.setTickLabelPaint(Tick_Label_COLOR); //x轴标签颜色
        dateAxis.setVerticalTickLabels(true);
        if (!StringUtils.isEmpty(timeAxisLabel)) {
            dateAxis.setLabel(timeAxisLabel); //设置 x 轴标签内容
        }

        plot.setDomainAxis(dateAxis);

        plot.setBackgroundPaint(Color.white); // 网格背景色
        plot.setOutlineVisible(false); //设置数据区的边界线条是否可见

        plot.setDomainGridlinePaint(Color.black); // 网格竖线颜色
        plot.setDomainGridlinesVisible(false); //网格竖线是否可见

        plot.setRangeGridlinePaint(GRID_LINE_COLOR); // 网格横线颜色
        plot.setRangeGridlinesVisible(true); //网格横线是否可见
        // 背景色 透明度
        plot.setBackgroundAlpha(0.1f);
        // 前景色 透明度
        plot.setForegroundAlpha(0.9f);

        String filename = UUID.randomUUID().toString() + ".jpg";
        ChartUtil.saveAsFile(chart, "jpg", PAHT + filename, 840, 400);
        return filename;
    }


    @Override
    public String timeChart(String title, String timeAxisLabel, String valueAxisLabel, String unit,
                            TimeSeriesCollection dataSet, Date lower, Date upper) {


        ChartFactory.setChartTheme(getStandardChartTheme());//设置主题样式

        JFreeChart chart = ChartFactory.createTimeSeriesChart(
                title,
                timeAxisLabel,
                valueAxisLabel,
                dataSet,
                false,
                false,
                false);

        // 设置日期显示格式
        XYPlot plot = chart.getXYPlot();

//        NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
//        rangeAxis.setAutoRangeIncludesZero(true);
//        rangeAxis.setTickLabelFont(Tick_Label_Font);
//        rangeAxis.setTickLabelPaint(Tick_Label_COLOR);

        setNumberAxis(plot);

        DateAxis axis = (DateAxis) plot.getDomainAxis();
        axis.setDateFormatOverride(new SimpleDateFormat("yyyy/MM"));
        if (!StringUtils.isEmpty(lower) && !StringUtils.isEmpty(upper)) {
            axis.setRange(lower, upper);
        }
        axis.setTickUnit(new DateTickUnit(DateTickUnitType.MONTH, 1));
        axis.setTickLabelPaint(Tick_Label_COLOR);
        axis.setTickLabelFont(Tick_Label_Font);
        axis.setVerticalTickLabels(true);

        setLineAndShapeRenderer(plot);
//        LineAndShapeRenderer renderer = (LineAndShapeRenderer) plot.getRenderer();
//        renderer.setDefaultShapesVisible(false); // series 点（即数据点）可见
//        renderer.setDefaultLinesVisible(true); // series 点（即数据点）间有连线可见
//        //renderer.setUseSeriesOffset(true); // 设置偏移量
//        renderer.setDefaultItemLabelGenerator(new StandardCategoryItemLabelGenerator());
//        renderer.setDefaultItemLabelsVisible(false);  //是否显示折点的值
//
//        renderer.setSeriesStroke(0, new BasicStroke(0.5F));//设置折线大小
//        renderer.setSeriesStroke(1, new BasicStroke(0.5F));//设置折线大小
//        renderer.setSeriesStroke(2, new BasicStroke(0.5F));//设置折线大小
//        renderer.setSeriesStroke(3, new BasicStroke(0.5F));//设置折线大小
//        renderer.setSeriesStroke(4, new BasicStroke(0.5F));//设置折线大小
//
//        renderer.setSeriesPaint(0, new Color(193, 35, 43));//设置折线颜色
//        renderer.setSeriesPaint(1, new Color(0, 184, 238));//设置折线颜色
//        renderer.setSeriesPaint(2, new Color(210, 51, 91));//设置折线颜色
//        renderer.setSeriesPaint(3, new Color(254, 158, 37));//设置折线颜色
//        renderer.setSeriesPaint(4, new Color(143, 195, 32));//设置折线颜色

//        axis.setPositiveArrowVisible(true);
//        axis.setTickMarkPosition(DateTickMarkPosition.START);


//        XYItemRenderer xyitem = plot.getRenderer();
//        xyitem.setDefaultItemLabelsVisible(true);
//        xyitem.setDefaultPositiveItemLabelPosition(new ItemLabelPosition(ItemLabelAnchor.OUTSIDE12, TextAnchor.BASELINE_LEFT));
//        xyitem.setDefaultItemLabelGenerator(new StandardXYItemLabelGenerator());
//        xyitem.setDefaultItemLabelFont(new Font("Dialog", 1, 14));
//        plot.setRenderer(xyitem);

        plot.setOutlineVisible(false); //设置数据区的边界线条是否可见

        plot.setBackgroundPaint(Color.white); // 网格背景色
        plot.setDomainGridlinePaint(Color.black); // 网格竖线颜色
        plot.setDomainGridlinesVisible(false); //网格竖线是否可见

        plot.setRangeGridlinePaint(new Color(226, 226, 226)); // 网格横线颜色
        plot.setRangeGridlinesVisible(true); //网格横线是否可见
        // 背景色 透明度
        plot.setBackgroundAlpha(0.1f);
        // 前景色 透明度
        plot.setForegroundAlpha(0.9f);

        String filename = new TimeString().getTimeString() + ".jpg";
        ChartUtil.saveAsFile(chart, "jpg", "/alldata/chart/" + filename, 840, 400);

        return filename;
    }


    /**
     * 设置主题样式
     *
     * @return
     */
    public StandardChartTheme getStandardChartTheme() {
        StandardChartTheme standardChartTheme = new StandardChartTheme("unicode"); //创建主题样式
        standardChartTheme.setExtraLargeFont(FONT_20); //设置标题字体
        standardChartTheme.setRegularFont(FONT_16); //设置图例的字体
        standardChartTheme.setLargeFont(FONT_16); //设置轴向的字体
        return standardChartTheme;
    }


    public void setLineAndShapeRenderer(XYPlot plot){
        XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) plot.getRenderer();
        renderer.setDefaultShapesVisible(false); // series 点（即数据点）可见
        renderer.setDefaultLinesVisible(true); // series 点（即数据点）间有连线可见
        //renderer.setUseSeriesOffset(true); // 设置偏移量
        renderer.setDefaultItemLabelGenerator(new StandardXYItemLabelGenerator());
        renderer.setDefaultItemLabelsVisible(false);  //是否显示折点的值

        renderer.setSeriesStroke(0, new BasicStroke(1.2F));//设置折线大小
        renderer.setSeriesStroke(1, new BasicStroke(0.8F));//设置折线大小
        renderer.setSeriesStroke(2, new BasicStroke(0.8F));//设置折线大小
        renderer.setSeriesStroke(3, new BasicStroke(0.8F));//设置折线大小
        renderer.setSeriesStroke(4, new BasicStroke(0.8F));//设置折线大小

        renderer.setSeriesPaint(0, new Color(193, 35, 43));//设置折线颜色
        renderer.setSeriesPaint(1, new Color(0, 184, 238));//设置折线颜色
        renderer.setSeriesPaint(2, new Color(210, 51, 91));//设置折线颜色
        renderer.setSeriesPaint(3, new Color(254, 158, 37));//设置折线颜色
        renderer.setSeriesPaint(4, new Color(143, 195, 32));//设置折线颜色
    }

    public void setXYLineAndShapeRenderer(XYPlot plot){
        LineAndShapeRenderer renderer = (LineAndShapeRenderer) plot.getRenderer();
        renderer.setDefaultShapesVisible(false); // series 点（即数据点）可见
        renderer.setDefaultLinesVisible(true); // series 点（即数据点）间有连线可见
        //renderer.setUseSeriesOffset(true); // 设置偏移量
        renderer.setDefaultItemLabelGenerator(new StandardCategoryItemLabelGenerator());
        renderer.setDefaultItemLabelsVisible(false);  //是否显示折点的值

        renderer.setSeriesStroke(0, new BasicStroke(0.5F));//设置折线大小
        renderer.setSeriesStroke(1, new BasicStroke(0.5F));//设置折线大小
        renderer.setSeriesStroke(2, new BasicStroke(0.5F));//设置折线大小
        renderer.setSeriesStroke(3, new BasicStroke(0.5F));//设置折线大小
        renderer.setSeriesStroke(4, new BasicStroke(0.5F));//设置折线大小

        renderer.setSeriesPaint(0, new Color(193, 35, 43));//设置折线颜色
        renderer.setSeriesPaint(1, new Color(0, 184, 238));//设置折线颜色
        renderer.setSeriesPaint(2, new Color(210, 51, 91));//设置折线颜色
        renderer.setSeriesPaint(3, new Color(254, 158, 37));//设置折线颜色
        renderer.setSeriesPaint(4, new Color(143, 195, 32));//设置折线颜色
    }

    public void  setNumberAxis(XYPlot plot){
        NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
        rangeAxis.setAutoRangeIncludesZero(true);
        rangeAxis.setTickLabelFont(Tick_Label_Font);
        rangeAxis.setTickLabelPaint(Tick_Label_COLOR);
    }

    public void setDateAxis(XYPlot plot){

    }
}
